import Config from '../../config/config'
import { DefaultDataModel } from '../../model/index'

function tspSignalList(req, res) {
  const resData = DefaultDataModel({
    options: [
      {
        label: 'Window Control',
        value: 'Window Control',
        children: [
          {
            label: 'onSpeed',
            value: 'xx888',
            children: null,
          },
          {
            label: 'onWindowStatus',
            value: 'xx999',
            children: null,
          },
        ],
      },
    ],
    signals: [
      {
        id: 'aaa',
        name: 'onSpeed',
        signalIdentifier: 'xx888',
        dataType: 'Integer',
        spec: {
          minimum: '120',
          maximum: '200',
          maxItems: '',
          minItems: '',
          minLength: '',
          maxLength: '',
          defalutvalue: '',
        },
        values: [],
        symbols: [
          { name: '等于', key: '==' },
          { name: '不等于', key: '!=' },
          { name: '大于', key: '>' },
          { name: '小于', key: '<' },
          { name: '小于等于', key: '<=' },
          { name: '大于等于', key: '>=' },
          { name: '开区间', key: '()' },
          { name: '闭区间', key: '[]' },
        ],
        signals: null,
      },
      {
        id: 'bbb',
        name: 'onWindowStatus',
        signalIdentifier: 'xx999',
        dataType: 'String',
        spec: {
          minimum: '20',
          maximum: '40',
          maxItems: '',
          minItems: '',
          minLength: '',
          maxLength: '',
          defalutvalue: '',
        },
        values: [
          { key: '0x1', value: 'FL' },
          { key: '0x2', value: 'FR' },
          { key: '0x3', value: 'FL&FR' },
          { key: '0x4', value: 'RL' },
          { key: '0x5', value: 'FL&RL' },
        ],
        symbols: [
          { name: '等于', key: '==' },
          { name: '不等于', key: '!=' },
        ],
        signals: null,
      },
    ],
  })
  res.json(resData)
}

function gacSignalList(req, res) {
  const resData = DefaultDataModel({
    options: [
      {
        name: 'Central Control',
        description: '中央控制域',
        id: 1,
        children: [
          {
            name: 'Power Window Control',
            description: '包括电动车窗升降、车窗禁止和指示灯、车窗未关提醒、防夹和标定参数管理等功能',
            id: 6,
            children: [
              {
                name: 'PlatService_a02',
                description: '',
                id: 92,
                children: [
                  { name: 'onSpeed', description: 'ag1', id: 128, children: null },
                  { name: 'onWindowStatus', description: '3', id: 131, children: null },
                ],
              },
            ],
          },
        ],
      },
    ],
    signals: [
      {
        id: 128,
        name: 'onSpeed',
        description: '车速通知',
        key: 'onSpeed',
        dataType: 'Integer',
        dataCategory: null,
        dataGroup: null,
        memberList: [
          {
            name: 'speedValue',
            symbols: [
              { name: '等于', key: '==' },
              { name: '不等于', key: '!=' },
              { name: '大于', key: '>' },
              { name: '小于', key: '<' },
              { name: '小于等于', key: '<=' },
              { name: '大于等于', key: '>=' },
              { name: '开区间', key: '()' },
              { name: '闭区间', key: '[]' },
            ],
            dataTypeSpecs: { unit: '', resolution: '', offset: '', physicalMin: '', physicalMax: '' },
            values: null,
          },
        ],
      },
      {
        id: 131,
        name: 'onWindowStatus',
        description: '四车窗状态',
        key: 'onWindowStatus',
        dataType: 'Integer',
        dataCategory: null,
        dataGroup: null,
        memberList: [
          {
            name: 'windowsStatus',
            symbols: [
              { name: '等于', key: '==' },
              { name: '不等于', key: '!=' },
            ],
            dataTypeSpecs: { unit: '', resolution: '', offset: '', physicalMin: '', physicalMax: '' },
            values: [
              { name: 'FL', key: '0x1' },
              { name: 'FR', key: '0x2' },
              { name: 'FL&FR', key: '0x3' },
              { name: 'RL', key: '0x4' },
              { name: 'FL&RL', key: '0x5' },
              { name: 'FR&RL', key: '0x6' },
              { name: 'FL&FR&RL', key: '0x7' },
              { name: 'RR', key: '0x8' },
              { name: 'FL&RR', key: '0x9' },
              { name: 'FR&RR', key: '0xa' },
              { name: 'FL&FR&RR', key: '0xb' },
              { name: 'RL&RR', key: '0xc' },
              { name: 'FL&RL&RR', key: '0xd' },
              { name: 'RF&RL&RR', key: '0xe' },
              { name: 'RL&FR&RL&RR', key: '0xf' },
            ],
          },
        ],
      },
    ],
    services: null,
  })

  res.json(resData)
}

function ecoSignalList(req, res) {
  const resData = DefaultDataModel({
    "options": [{
			"label": "生活服务",
			"value": "生活服务",
			"children": [{
				"label": "当前天气",
				"value": "1",
				"children": null
			}, {
				"label": "本地城市（地区)天气情况",
				"value": "2",
				"children": null
			}]
		}],
		"signals": [{
			"id": "1",
			"name": "当前天气",
			"signalIdentifier": "a",
			"dataType": "enum",
			"spec": {
				"min": null,
				"max": null,
				"signalUnit": null
			},
			"values": [{
				"key": "恶劣天气",
				"value": "0"
			}, {
				"key": "正常天气",
				"value": "1"
			}],
			"symbols": [{
				"name": "等于",
				"key": "=="
			}, {
				"name": "不等于",
				"key": "!="
			}],
			"signals": null
		}, {
			"id": "2",
			"name": "本地城市（地区）天气情况",
			"signalIdentifier": "b",
			"dataType": "enum",
			"spec": {
				"min": null,
				"max": null,
				"signalUnit": null
			},
			"values": [{
				"key": "晴天",
				"value": "0"
			}, {
				"key": "多云",
				"value": "1"
			}, {
				"key": "小雨",
				"value": "2"
			}, {
				"key": "中雨",
				"value": "3"
			}, {
				"key": "大雨",
				"value": "4"
			}, {
				"key": "暴雨",
				"value": "5"
			}],
			"symbols": [{
				"name": "等于",
				"key": "=="
			}, {
				"name": "不等于",
				"key": "!="
			}],
			"signals": null
		}]
  })

  res.json(resData)
}

const ResponseList = [
  {
    path: `${Config.baseURL}/api/object/tspSignals`,
    method: 'get',
    fun: tspSignalList,
  },
  {
    path: `${Config.baseURL}/api/object/gacMetaSignals`,
    method: 'get',
    fun: gacSignalList,
  },
  {
    path: `${Config.baseURL}/api/object/ecologySignals`,
    method: 'get',
    fun: ecoSignalList,
  },
]

export default ResponseList
